<?php

namespace App\Events\CallingCards;

use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class OfficialRecordEvent
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public string $ip;
    public int    $invitorId;
    public string $name;
    public string $mobile;
    public string $province;
    public string $city;
    public string $district;
    public string $remark;

    public function __construct(string $ip, int $invitorId, string $name, string $mobile, string $province,
                                string $city, string $district, string $remark)
    {
        $this->ip        = $ip;
        $this->invitorId = $invitorId;
        $this->name      = $name;
        $this->mobile    = $mobile;
        $this->province  = $province;
        $this->city      = $city;
        $this->district  = $district;
        $this->remark    = $remark;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
        return new PrivateChannel('channel-name');
    }
}
